package slevnik;

import java.util.Date;

/**
 *
 * @author Eduard Krak, Martin Penak
 */
public class ItemImpl implements Item {

    private String title;
    private String url;
    private String city;
    private double finalPrice;
    private double originalPrice;
    private Date dealStart;
    private Date dealEnd;
    private double discount;
    private int categoryId;
    private int customers;
    private int id;

    public ItemImpl() {
    }

    public ItemImpl(String title, String url, String city, double finalPrice, double originalPrice, Date dealStart, Date dealEnd, double discount, int categoryId, int customers) {
        this.title = title;
        this.url = url;
        this.city = city;
        this.finalPrice = finalPrice;
        this.originalPrice = originalPrice;
        this.dealStart = dealStart;
        this.dealEnd = dealEnd;
        this.discount = discount;
        this.categoryId = categoryId;
        this.customers = customers;
    }

    public int getCategoryId() {
        return categoryId;
    }

    public void setCategoryId(int categoryId) {
        this.categoryId = categoryId;
    }

    public String getCity() {
        return city;
    }

    public void setCity(String city) {
        this.city = city;
    }

    public int getCustomers() {
        return customers;
    }

    public void setCustomers(int customers) {
        this.customers = customers;
    }

    public Date getDealEnd() {
        return dealEnd;
    }

    public void setDealEnd(Date dealEnd) {
        this.dealEnd = dealEnd;
    }

    public Date getDealStart() {
        return dealStart;
    }

    public void setDealStart(Date dealStart) {
        this.dealStart = dealStart;
    }

    public double getDiscount() {
        return discount;
    }

    public void setDiscount(double discount) {
        this.discount = discount;
    }

    public double getFinalPrice() {
        return finalPrice;
    }

    public void setFinalPrice(double finalPrice) {
        this.finalPrice = finalPrice;
    }

    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    public double getOriginalPrice() {
        return originalPrice;
    }

    public void setOriginalPrice(double originalPrice) {
        this.originalPrice = originalPrice;
    }

    public String getTitle() {
        return title;
    }

    public void setTitle(String title) {
        this.title = title;
    }

    public String getUrl() {
        return url;
    }

    public void setUrl(String url) {
        this.url = url;
    }

    @Override
    public boolean equals(Object obj) {
        if (obj == null) {
            return false;
        }
        if (getClass() != obj.getClass()) {
            return false;
        }
        final ItemImpl other = (ItemImpl) obj;
        if ((this.title == null) ? (other.title != null) : !this.title.equals(other.title)) {
            return false;
        }
        if ((this.url == null) ? (other.url != null) : !this.url.equals(other.url)) {
            return false;
        }
        if ((this.city == null) ? (other.city != null) : !this.city.equals(other.city)) {
            return false;
        }
        if (Double.doubleToLongBits(this.finalPrice) != Double.doubleToLongBits(other.finalPrice)) {
            return false;
        }
        if (Double.doubleToLongBits(this.originalPrice) != Double.doubleToLongBits(other.originalPrice)) {
            return false;
        }
        if (this.dealStart != other.dealStart && (this.dealStart == null || !this.dealStart.equals(other.dealStart))) {
            return false;
        }
        if (this.dealEnd != other.dealEnd && (this.dealEnd == null || !this.dealEnd.equals(other.dealEnd))) {
            return false;
        }
        if (Double.doubleToLongBits(this.discount) != Double.doubleToLongBits(other.discount)) {
            return false;
        }
        if (this.categoryId != other.categoryId) {
            return false;
        }
        if (this.customers != other.customers) {
            return false;
        }
        if (this.id != other.id) {
            return false;
        }
        return true;
    }

    @Override
    public int hashCode() {
        int hash = 7;
        hash = 59 * hash + (this.title != null ? this.title.hashCode() : 0);
        hash = 59 * hash + (this.url != null ? this.url.hashCode() : 0);
        hash = 59 * hash + (this.city != null ? this.city.hashCode() : 0);
        hash = 59 * hash + (int) (Double.doubleToLongBits(this.finalPrice) ^ (Double.doubleToLongBits(this.finalPrice) >>> 32));
        hash = 59 * hash + (int) (Double.doubleToLongBits(this.originalPrice) ^ (Double.doubleToLongBits(this.originalPrice) >>> 32));
        hash = 59 * hash + (this.dealStart != null ? this.dealStart.hashCode() : 0);
        hash = 59 * hash + (this.dealEnd != null ? this.dealEnd.hashCode() : 0);
        hash = 59 * hash + (int) (Double.doubleToLongBits(this.discount) ^ (Double.doubleToLongBits(this.discount) >>> 32));
        hash = 59 * hash + this.categoryId;
        hash = 59 * hash + this.customers;
        hash = 59 * hash + this.id;
        return hash;
    }

}
